# 利用百度搜索关键词
from urllib import request
from urllib import  parse
from fake_useragent import  UserAgent
import webbrowser

ua = UserAgent()
headers = {
    'User-Agent': ua.random,
}
url = 'https://www.baidu.com/s?' + parse.urlencode({'wd':'功夫+周西成'})
req = request.Request(url,headers=headers)
response = request.urlopen(req)
result = response.read().decode()
with open('result.html','w') as f:
    f.write(result)
    webbrowser.open('result.html')
